package org.xbs.demo1.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.xbs.demo1.pojo.User;
import org.xbs.demo1.pojo.UserQueryParam;

import java.util.List;

@Mapper
public interface UserMapper {
    @Select("select users.name,case users.gender "+
    "when '1' then '男'"+
    "when '2' then '女'"+
    "end as gender,users.phone,jobs.job_name,users.salary,users.image,users.entry_date,depts.dept_name "+
    "from users "+
    "left join depts on users.dept_id=depts.id "+
    "left join jobs on users.job=jobs.id where users.id = #{id}")
    User getUserById(Integer id);//查询回显
    void updateUser(User user);//支持部分更新的更新方法
@Select("select count(*) from users")
    Integer getUsersTotal();//查询所有员工数据的总数
    List<User> getUsers(UserQueryParam userQueryParam);//条件分页查询

    void deleteUsers(List<Integer> ids);//根据id批量删除用户

    void addUsers(List<User> users);//批量添加用户信息
}

